package com.ai.bitcoin.jpa.service.impl;

import com.ai.bitcoin.jpa.dao.BccDailyInfoHisDao;
import com.ai.bitcoin.jpa.entity.BccDailyInfoHis;
import com.ai.bitcoin.jpa.service.BccDailyInfoHisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Jason
 * @date 2018/4/4
 **/
@Component
@Slf4j
public class BccDailyInfoHisServiceImpl implements BccDailyInfoHisService {
    @Autowired
    BccDailyInfoHisDao dao;

    @Override
    public List<BccDailyInfoHis> findByBccIdAndBatchNo(String bccId, String batchNo) {
        return dao.findByBccIdAndBatchNo(bccId, batchNo);
    }

    @Override
    public List<BccDailyInfoHis> findByBccIdAndRecordState(String bccId, String recordState) {
        return dao.findByBccIdAndRecordState(bccId, recordState);
    }

    @Override
    @Transactional
    public void update2Publish(String unPublishBatch) {
        dao.deleteOldPublish(unPublishBatch);
        dao.update2Publish(unPublishBatch);
    }

    @Override
    @Transactional
    public void deleteNoPublish() {
        dao.deleteNoPublish();
    }

    @Override
    public List<BccDailyInfoHis> findByBccId(String bccId) {
        return dao.findByBccId(bccId);
    }

    @Override
    @Transactional
    public void save(BccDailyInfoHis BccDailyInfoHis) {
        dao.save(BccDailyInfoHis);
    }

    @Override
    public List<BccDailyInfoHis> findByBccIdYesterday(String bccId) {
        return dao.findByBccIdYesterday(bccId);
    }

}
